ANDROID: HID: Only utilise UHID provided exports if UHID is enabled

Commit "ANDROID: HID; Over-ride default maximum buffer size when using
UHID" provided a means for the UHID driver to offer an alternative
(smaller) report buffer size when dealing with user-space.  The method
used was an Android-only solution designed to prevent the KMI ABI from
being broken (nb: the upstream solution was cleaner, but broke the ABI).

Since this solution involved consuming resources exported by a
subordinate driver, that driver would have to be enabled for the export
to take place.  Since all of our default configs enable UHID, an issue
was not detected.  However, for more specific kernel configs, where HID
is enabled, but UHID is not, this leads to compile-time undefined symbol
errors:

  ld.lld: error: undefined symbol: uhid_hid_driver

This patch relies on the compiler to leave out unutilised sections of
the code if the associated resources are not available.

Bug: 260007429
Reported-by: Paul Lawrence <paullawrence@google.com>
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I80b1aa7454c89d5c5e21f0268252ffb666efab97
Signed-off-by: Lee Jones <joneslee@google.com>
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 8698a12..ba9f34e 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -290,7 +290,7 @@
 	offset = report->size;
 	report->size += parser->global.report_size * parser->global.report_count;
 
-	if (parser->device->ll_driver == &uhid_hid_driver)
+	if (IS_ENABLED(CONFIG_UHID) && parser->device->ll_driver == &uhid_hid_driver)
 		max_buffer_size = UHID_DATA_MAX;
 
 	/* Total size check: Allow for possible report index byte */
@@ -1767,7 +1767,7 @@
 
 	rsize = hid_compute_report_size(report);
 
-	if (hid->ll_driver == &uhid_hid_driver)
+	if (IS_ENABLED(CONFIG_UHID) && hid->ll_driver == &uhid_hid_driver)
 		max_buffer_size = UHID_DATA_MAX;
 
 	if (report_enum->numbered && rsize >= max_buffer_size)